package cn.bone.cloud.compute.ribbon.service;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * Created by Administrator on 2017/11/3.
 */
@Service
public class ConsumerService {

    @Resource
    private RestTemplate restTemplate;

    @HystrixCommand(fallbackMethod = "addServiceFailBack")
    public String addService(){
        return restTemplate.getForEntity("http://compute-server/add?a=8&b=13",String.class).getBody();
    }

    public String addServiceFailBack(){
        return "error";
    }
}
